<?
require("config.php");

$Query = "SELECT 
date,
name,
last_name,
email,
tel,
mobile,
profession, 
company,
branch,
zip,
address, 
city,  
state, 
country, 
lang_english, 
lang_dannish, 
lang_chinese
FROM $table order by date desc";

$r=myQuery($Query);


header("Content-type:application/vnd.ms-excel");  
header("Content-Disposition:filename=News_en_" . date("Ymd") . ".xls");  

echo "subscription date\t";
echo "name\t";
echo "last_name\t";
echo "email\t";
echo "tel\t"; 
echo "mobile\t";
echo "profession\t"; 
echo "company\t";
echo "branch\t";
echo "zip\t"; 
echo "address\t";
echo "city\t"; 
echo "state\t"; 
echo "country\t"; 
echo "Language - English\t";
echo "Language - Danish\t";
echo "Language - Chinese\t\n";

for ($i=0;$i<count($r);$i++){

	for($j=0;$j<17;$j++)
	{
		echo $r[$i][$j] . "\t"; 
	}
	echo "\n";
//echo $r[$i][0] . "\t"; 
//echo $r[$i][1] . "\t"; 
//echo $r[$i][2] . "\t"; 
//echo $r[$i][3] . "\t"; 
//echo $r[$i][4] . "\t"; 
//echo $r[$i][5] . "\t"; 
//str_replace("\t"," ",str_replace("\n"," ",str_replace("\r"," ",$r[$i][6])))."\t";
//echo $r[$i][7] . "\t"; 
//echo $r[$i][8] . "\t"; 
//echo $r[$i][9] . "\t"; 
//echo $r[$i][10] . "\t"; 
//echo $r[$i][11] . "\t"; 
//echo $r[$i][12] . "\t";  
//echo $r[$i][13] . "\t\n"; 
}
?>